package com.hb.gp.util;

/**
 * Title:        connector server
 * Description:
 * Copyright:    Copyright (c) 2006
 * Company:      Hengbao
 * @author dxd
 * @version 1.0
 */

public class BytesToInt
{
  byte[] byteSource;
  public BytesToInt(byte[] source)
  {
    byteSource=new byte[4];
    System.arraycopy(source,0,byteSource,0,4);
  }
  public static int GetInt(byte[] source)
  {
    int nInt=0x00000000;
    for(int i=0;i<source.length;i++)
    {
      nInt=(nInt<<8)+(source[i]&0x000000ff);
    }
    return nInt;
  }
  public  int GetInt()
  {
    int nInt=0x00000000;
    for(int i=0;i<4;i++)
    {
      nInt=(nInt<<8)+(byteSource[i]&0x000000ff);
    }
    return nInt;
  }
  public int GetIntelInt()
  {
    int nInt=0;
    for(int i=3;i>=0;i--)
    {
      nInt=(nInt<<8)+(byteSource[i]&0x000000ff);
    }
    return nInt;
  }
}